package org.example.api.dic;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.example.system.common.bean.MyFeignBlockHandlerService;
import org.example.system.common.bean.MyFeignFallbackService;
import org.example.system.common.constant.ServiceConstant;
import org.example.system.common.dto.dic.DicInfoDto;
import org.example.system.common.utils.ResponseUtil;
import org.example.system.common.vo.PageIntVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name=ServiceConstant.KEY_DIC)
public interface IDicServiceFeignClient {
    /**
     * 根据字典类型查询字典列表
     * @param typeKey
     * @return
     */
    @SentinelResource(value = "/v1/dicInfo/list",
            fallbackClass= MyFeignFallbackService.class,fallback = "fallback",
            blockHandlerClass = MyFeignBlockHandlerService.class,blockHandler="blockHandler")
    @GetMapping("/v1/dicInfo/list")
    ResponseUtil<PageIntVo<DicInfoDto>> queryDicInfoList(
            @RequestParam("typeKey") String typeKey);
    /**
     * 查询字典值
     * @return
     */
    @SentinelResource(value = "/v1/dicInfo/text",
            fallbackClass= MyFeignFallbackService.class,fallback = "fallback",
            blockHandlerClass = MyFeignBlockHandlerService.class,blockHandler="blockHandler")
    @GetMapping("/v1/dicInfo/text")
    ResponseUtil<String> queryDicInfoText(
            @RequestParam("typeKey") String typeKey,
            @RequestParam("dicKeys") String dicKeys);
}
